package com.chencs.app.lianmeng.controller;


import com.alibaba.fastjson.JSON;
import com.chencs.app.AppCommon;
import com.chencs.app.lianmeng.service.LMBannerSer;
import com.chencs.vo.biz.model.ModeModel;
import com.chencs.vo.net.lmrequest.LmBannerRequest;
import com.chencs.vo.net.lmrequest.LmRegisterRequest;
import com.chencs.vo.net.lmresponse.LmBannerResponse;
import com.chencs.vo.net.lmresponse.LmRegisterResponse;
import com.chencs.vo.net.request.RequestBase;
import com.chencs.vo.net.response.AdverResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * banner相关
 */
@RestController
@RequestMapping("/app/lmBanner")
public class LMBannerCtr {


    @Autowired
    private LMBannerSer lmBannerSer;

    /**
     * 获取首页轮播图
     * @param request
     * @return
     */
    @RequestMapping(value = "/getSlideBanner", method = RequestMethod.POST, produces = "application/json; charset=UTF-8")
    public String getSlideBanner(@RequestBody LmBannerRequest request){
        LmBannerResponse response = lmBannerSer.getSlideBanner(request);
        return JSON.toJSONString(response);
    }

    /**
     * 获取启动图轮播图
     * @param request
     * @return
     */
    @RequestMapping(value = "/getStartBanner", method = RequestMethod.POST, produces = "application/json; charset=UTF-8")
    public String getStartBanner(@RequestBody LmBannerRequest request){
        LmBannerResponse response = lmBannerSer.getStartBanner(request);
            return JSON.toJSONString(response);
        }

    /**
     * 获取首页弹窗
     * @param request
     * @return
     */
    @RequestMapping(value = "/getPopBanner", method = RequestMethod.POST, produces = "application/json; charset=UTF-8")
    public String getPopBanner(@RequestBody LmBannerRequest request){
        LmBannerResponse response = lmBannerSer.getPopBanner(request);
        return JSON.toJSONString(response);
    }


    /**
     * 更具关键词取出广告图
     * @param request
     * @return
     */
    @RequestMapping(value = "/getBannerByKey", method = RequestMethod.POST, produces = "application/json; charset=UTF-8")
    public String getBannerByKey(@RequestBody LmBannerRequest request){
        LmBannerResponse response = lmBannerSer.getBannerByKey(request);
        return JSON.toJSONString(response);
    }


}
